var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    yiyuanList: [
      { id: 0, yytitle: "北京同仁医院亦庄院区同仁医院亦庄院区", num: 8, money: 63536 },
      { id: 1, yytitle: "北京同仁医院亦庄院区同仁医院亦庄院区", num: 8, money: 63536 },
      { id: 2, yytitle: "北京同仁医院亦庄院区同仁医院亦庄院区", num: 8, money: 63536 },
      { id: 3, yytitle: "北京同仁医院亦庄院区同仁医院亦庄院区", num: 8, money: 63536 },
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    var that = this;
    var tjt_id = options.tjt_id;
    this.getTijian_taocan_typexq(tjt_id);
    this.getTijian_taocan_typexqs(tjt_id);
    this.getTijian_taocan_yiyuanlist(tjt_id);
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () { //下拉刷新
    wx.showNavigationBarLoading();
    setTimeout(function () {
      wx.hideNavigationBarLoading();
      wx.stopPullDownRefresh();
    }, 1000);

    var that = this;
    var tjt_id = data.tjt_id;
    this.getTijian_taocan_typexq(tjt_id);
    this.getTijian_taocan_typexqs(tjt_id);
    this.getTijian_taocan_yiyuanlist(tjt_id);
  },


  getTijian_taocan_typexq: function (tjt_id) {
    var that = this;
    console.log(app);
    app.util.request({
      'url': 'entry/wxapp/Tijian_taocan_typexq',
      'data': {
        tjt_id: tjt_id,
      },
      'cachetime': '30',
      success: function (res) {
        that.setData({
          tc_typexq: res.data.data,

        })
        wx.setNavigationBarTitle({ title: that.data.tc_typexq.type });
      },
      fail: function (err) {
        console.log(err)
      },

    })
  },
  getTijian_taocan_typexqs: function (tjt_id) {
    var that = this;
    app.util.request({
      'url': 'entry/wxapp/Tijian_taocan_typexqs',
      'data': {
        tjt_id: tjt_id,
      },
      success: function (res) {
        that.setData({
          tc_typexqs: res.data.data,

        })
        
      },
      fail: function (err) {
        console.log(err)
      },

    })
  },
  getTijian_taocan_yiyuanlist: function (tjt_id) {
    var that = this;
    console.log(app);
    app.util.request({
      'url': 'entry/wxapp/Tijian_taocan_yiyuanlist',
      'data': {
        tjt_id: tjt_id,
      },
      'cachetime': '30',
      success: function (res) {
        that.setData({
          tc_yylist: res.data.data,

        })
      },
      fail: function (err) {
        console.log(err)
      },

    })
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  tjxqClick:function(event){
    var tt_id = event.currentTarget.dataset.tt_id;
    var ty_id = event.currentTarget.dataset.ty_id;
    wx:wx.navigateTo({
      url: '../tcxq/tcxq?tt_id=' + tt_id + "&ty_id="+ty_id,
    })
  }
})